package r2118nw.d1120;

import java.util.ArrayList;
import java.util.Collection;

public class Demo02 {
    public static void main(String[] args) {
        Collection coll = new ArrayList();
        coll.add(new Student("张三","01"));
        coll.add(new Student("李四","02"));
        coll.add(new Student("王五","03"));
        coll.add(new Student("赵六","04"));
        coll.add(new Student("吴七","05"));
        coll.add(new Student("韩八","06"));
//        遍历集合
//        for(Object str:coll){
//            System.out.println(str);
//        }
//        迭代器遍历集合
//        Iterator it = coll.iterator();
//        while (it.hasNext()){
//            System.out.println(it.next());
//        }

//        集合方法 lambda方式的forEach
        coll.forEach((s)->{
            System.out.println(s);
        });
    }
}
